﻿<script src="~/admui-13945148017-1592211513218/public/themes/global/js/components/bootstrap-datepicker.min.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/bootstrap-datepicker/bootstrap-datepicker.zh-CN.min.js"></script>
<link href="~/admui-13945148017-1592211513218/public/vendor/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet" />
<script type="text/javascript">
    $(document).ready(function () {
            $("#SpanShuJu").click();
        //$("#SpanRenYuan").click();
        bangdingshuju();
        bumen();
        bang();


        $('#SelZhanQu').change(function () {
            var selZhanQu = $("#SelZhanQu").find("option:selected").val();
            if (selZhanQu != "0") {
                $('#SelZhanDui option').remove();
                zhandui(selZhanQu);
            } else {
                $('#SelZhanDui option').remove();
            }
        })
        BangZhiYe();
    });

    function zhandui(ZhanQuId) {
        $.ajax({
            url: "../RenYuan/GetSelZhanDui",
            data: { "ZhanQuId": ZhanQuId },
            type: "post",
            dataType: "json",
            success: function (date) {
                var ddl = $("#SelZhanDui");
                ddl.append("<option value='0'>请选择</option>");
                $(date).each(function (key) {
                    if (date[key].id == "1") {

                    } else {
                        var opt = $("<option></option>").text(date[key].ZhanDuiMingCheng).val(date[key].id);
                        ddl.append(opt);
                    }
                })
            }
        });
    }
    function bumen() {
        $.ajax({
            url: "../RenYuan/GetSelBuMen",
            type: "post",
            data: { "GongSiId": 8 },
            dataType: "json",
            success: function (date) {
                //var ddl = $("#dl_BuMen");
                //ddl.append("<option value='0'>请选择</option>");
                //$(date).each(function (key) {
                //    if (date[key].Id == "1") {

                //    } else {
                //        var opt = $("<option></option>").text(date[key].BuMenMingCheng).val(date[key].Id);
                //        ddl.append(opt);
                //    }
                //})
                var sss = "<option value=\"0\">请选择</option>";
                for (var i = 0; i < date.length; i++) {
                    if (date[i].Id != 1) {
                        sss += "<option value=\"" + date[i].Id + "\">" + date[i].BuMenMingCheng + "</option>";
                    }
                }
                $("#dl_BuMen").html(sss);

            }
        });
    }
    function bangdingshuju() {


        $.ajax({
            type: 'post',
            url: "../RenYuan/GetSelZhanQu",
            async: false,
            dataType: 'json',
            success: function (date) {
                var ddl = $("#SelZhanQu");
                ddl.append("<option value='0'>请选择</option>");
                $(date).each(function (key) {
                    if (date[key].Id == "1") {

                    } else {
                        var opt = $("<option></option>").text(date[key].ZhanQuMingCheng).val(date[key].Id);
                        ddl.append(opt);
                    }
                })
                $("#SelZhanDui").html("<option value='0'>请选择</option>");

            },
        })
    }
    function chongzhi() {
        $("#XingMing").val("");
        $("#SelZhanQu").find("option:selected").val(0);
        $("#SelZhanDui").find("option:selected").val(0);
        bang();
    }
    function chongzhi1() {
        $("#txt_XingMing").val("");
        $("#dl_BuMen").find("option:selected").val(0);
        bangZhiYe();
    }
    function bang() {
        var xingming = $("#XingMing").val();
        var selZhanQu = $("#SelZhanQu").find("option:selected").val();
        var selZhanDui = $("#SelZhanDui").find("option:selected").val();
        var KaiShiShiJian = $("#txt_KaiShiShiJian_YeWu").val();
        var JieShuShiJian = $("#txt_JieShuShiJian_YeWu").val();
        var lang = {
            "sProcessing": "大量处理中，请稍后...",
            "sLengthMenu": "每页 _MENU_ 项",
            "sZeroRecords": "没有匹配结果",
            "sInfo": "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
            "sInfoEmpty": "当前显示第 0 至 0 项，共 0 项",
            "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
            "sInfoPostFix": "",
            "sSearch": "搜索:",
            "sUrl": "",
            "sEmptyTable": "表中数据为空",
            "sLoadingRecords": "载入中...",
            "sInfoThousands": ",",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "上页",
                "sNext": "下页",
                "sLast": "末页",
                "sJump": "跳转"
            },
            "oAria": {
                "sSortAscending": ": 以升序排列此列",
                "sSortDescending": ": 以降序排列此列"
            }
        };
        $("#dataTableExample").dataTable().fnDestroy();
        $('#dataTableExample').dataTable({
            "order": [[5, "desc"]],
            "language": lang,
            "processing": true,
            "serverSide": true,
            //"bStateSave": true,//状态保持模式
            "searching": false,//禁用搜索
            ajax: function (data, callback, settings) {
                //封装请求参数
                console.log(data);

                var param = {};
                param.limit = data.length;//页面显示记录条数，在页面显示每页显示多少项的时候
                param.start = data.start;//开始的记录序号
                param.page = (data.start / data.length) + 1;//当前页码
                param.dir = data.order[0].dir;
                param.column = data.order[0].column;
                param.xingming = xingming;
                param.selZhanQu = selZhanQu;
                param.selZhanDui = selZhanDui;
                param.KaiShiShiJian = KaiShiShiJian;
                param.JieShuShiJian = JieShuShiJian;
                //console.log(param);

                //ajax请求数据
                $.ajax({
                    type: "POST",
                    url: "../Home/InitializationDataTable",
                    cache: false,  //禁用缓存
                    data: param,  //传入组装的参数
                    dataType: "json",
                    success: function (result) {
                        console.log(result);
                        //setTimeout仅为测试延迟效果
                        setTimeout(function () {
                            //封装返回数据
                            var returnData = {};
                            returnData.draw = data.draw;//这里直接自行返回了draw计数器,应该由后台返回
                            returnData.recordsTotal = result.total;//返回数据全部记录
                            returnData.recordsFiltered = result.total;//后台不实现过滤功能，每次查询均视作全部结果
                            returnData.data = result.data;//返回的数据列表
                            //console.log(returnData);
                            //调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
                            //此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕"orderable" : false
                            callback(returnData);
                        }, 200);
                    }
                });
            },
            "columns": [
                { "data": "XingMing" },
                { "data": "ZhanQuMingCheng" },
                { "data": "ZhanDuiMingCheng" },
                { "data": "BaoBeiShu" },
                { "data": "DaiKanShu" },
                { "data": "ChengJiaoShu" },
                { "data": "ChengJiaoShu", render: function (data, type, row) { return "<label>" + JiSuanZhuanHuanLv(row.DaiKanShu, row.ChengJiaoShu) + "</label>" } }
            ]
        });
    }

    function JiSuanZhuanHuanLv(DaiKanShu, ChengJiaoShu) {

        if (ChengJiaoShu == 0) {
            return DaiKanShu + " ：0";
        }
        if (DaiKanShu != 0 && ChengJiaoShu != 0) {
            var a = (DaiKanShu / ChengJiaoShu) + "";
            var xiabiao = a.indexOf(".");
            var b = a.substring(xiabiao, a.length);
            if (b.length > 2) {
                a = a.toFixed(2);
            }
            return a + " ：1";
        }
    }


    function BangZhiYe() {
        var XingMing = $("#txt_XingMing").val();
        var BuMenId = $("#dl_BuMen").find("option:selected").val();
        var KaiShiShiJian = $("#txt_KaiShiShiJian_ZhiYe").val();
        var JieShuShiJian = $("#txt_JieShuShiJian_ZhiYe").val();
        var lang = {
            "sProcessing": "大量处理中，请稍后...",
            "sLengthMenu": "每页 _MENU_ 项",
            "sZeroRecords": "没有匹配结果",
            "sInfo": "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
            "sInfoEmpty": "当前显示第 0 至 0 项，共 0 项",
            "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
            "sInfoPostFix": "",
            "sSearch": "搜索:",
            "sUrl": "",
            "sEmptyTable": "表中数据为空",
            "sLoadingRecords": "载入中...",
            "sInfoThousands": ",",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "上页",
                "sNext": "下页",
                "sLast": "末页",
                "sJump": "跳转"
            },
            "oAria": {
                "sSortAscending": ": 以升序排列此列",
                "sSortDescending": ": 以降序排列此列"
            }
        };
        $("#dataTableExample1").dataTable().fnDestroy();
        $('#dataTableExample1').dataTable({
            "order": [[4, "desc"]],
            "language": lang,
            "processing": true,
            "serverSide": true,
            //"bStateSave": true,//状态保持模式
            "searching": false,//禁用搜索
            ajax: function (data, callback, settings) {
                //封装请求参数
                //console.log(data);

                var param = {};
                param.limit = data.length;//页面显示记录条数，在页面显示每页显示多少项的时候
                param.start = data.start;//开始的记录序号
                param.page = (data.start / data.length) + 1;//当前页码
                param.dir = data.order[0].dir;
                param.column = data.order[0].column;
                param.XingMing = XingMing;
                param.BuMenId = BuMenId;
                param.KaiShiShiJian = KaiShiShiJian;
                param.JieShuShiJian = JieShuShiJian;

                //console.log(param);

                //ajax请求数据
                $.ajax({
                    type: "POST",
                    url: "../Home/InitializationDataTable1",
                    cache: false,  //禁用缓存
                    data: param,  //传入组装的参数
                    dataType: "json",
                    success: function (result) {
                        console.log(result);
                        //setTimeout仅为测试延迟效果
                        setTimeout(function () {
                            //封装返回数据
                            var returnData = {};
                            returnData.draw = data.draw;//这里直接自行返回了draw计数器,应该由后台返回
                            returnData.recordsTotal = result.total;//返回数据全部记录
                            returnData.recordsFiltered = result.total;//后台不实现过滤功能，每次查询均视作全部结果
                            returnData.data = result.data;//返回的数据列表
                            //console.log(returnData);
                            //调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
                            //此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕"orderable" : false
                            callback(returnData);
                        }, 200);
                    }
                });
            },
            "columns": [
                { "data": "XingMing" },
                { "data": "BuMenMingCheng" },
                { "data": "BaoBeiShu" },
                { "data": "DaiKanShu" },
                { "data": "ChengJiaoShu" },
                { "data": "ChengJiaoShu", render: function (data, type, row) { return "<label>" + JiSuanZhuanHuanLv(row.DaiKanShu, row.ChengJiaoShu) + "</label>" } }
            ]
        });
    }

</script>

<div class="page-container" id="admui-pageContent">
    <div class="page animation-fade page-forms">
        <div class="page-content">
            <div class="panel">
                <div class="page-header">
                    <h1 class="page-title">人员列表</h1>
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item">
                            <a class="icon wb-home" href="javascript:;">人员管理</a>
                        </li>
                        <li class="breadcrumb-item active">人员列表</li>
                    </ol>
                </div>
                <div class="example-wrap">
                    <div class="nav-tabs-horizontal" data-approve="nav-tabs">
                        <ul class="nav nav-tabs" role="tablist">
                            <li class="nav-item">
                                <a class="nav-link active" data-toggle="tab" href="#exampleTabsOne"
                                   aria-controls="exampleTabsOne" role="tab">
                                    业务员
                                </a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" data-toggle="tab" href="#exampleTabsTwo" aria-controls="exampleTabsTwo"
                                   role="tab">
                                    置业顾问
                                </a>
                            </li>
                            @*<li class="nav-item">
                                    <a class="nav-link" data-toggle="tab" href="#exampleTabsThree" aria-controls="exampleTabsThree"
                                       role="tab">
                                        最热
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" data-toggle="tab" href="#exampleTabsFour" aria-controls="exampleTabsFour"
                                       role="tab">
                                        深度
                                    </a>
                                </li>*@
                        </ul>
                        <div class="tab-content pt-20">
                            <div class="tab-pane active" id="exampleTabsOne" role="tabpanel">
                                <div class="panel-body">
                                    <h4 class="example-title">数据查询</h4>
                                    <div class="row">
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">姓名</label>
                                            <input id="XingMing" class="form-control" />
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">战区</label>
                                            <select id="SelZhanQu" class="form-control">
                                            </select>
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">战队</label>
                                            <select id="SelZhanDui" class="form-control">
                                            </select>
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">开始时间</label>
                                            <input type="text" class="form-control empty" autocomplete="off" data-date-format="yyyy-mm-dd" name="" id="txt_KaiShiShiJian_YeWu" data-plugin="datepicker" data-language="zh-CN" placeholder="请输入查询开始时间" />
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">结束时间</label>
                                            <input type="text" class="form-control empty" autocomplete="off" data-date-format="yyyy-mm-dd" name="" id="txt_JieShuShiJian_YeWu" data-plugin="datepicker" data-language="zh-CN" placeholder="请输入查询开始时间" />
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <div class="form-group col-sm-12" style="padding-top:27px">
                                                <button type="button" id="bt_ChaXun" class="btn btn-block btn-success" style="width: 45%; float: left;" onclick="bang()"><i class="icon wb-search"></i>查询</button>
                                                <button typeutton" id="bt_ChongZhi" class="btn btn-outline btn-success" style="width: 45%; margin-left:5%;" onclick="chongzhi();">重置</button>
                                            </div>

                                        </div>


                                    </div>
                                </div>
                                <div class="panel-body" style="margin-top:-50px">
                                    <table class="table table-bordered table-hover dataTable table-striped w-full text-nowrap" id="dataTableExample" data-plugin="dataTable">
                                        <thead>
                                            <tr>
                                                <th>姓名</th>
                                                <th>战区</th>
                                                <th>战队</th>
                                                <th>报备数量</th>
                                                <th>带看数量</th>
                                                <th>成交数量</th>
                                                <th>带看转换率</th>
                                            </tr>
                                        </thead>
                                        <tfoot>
                                            <tr>
                                                <th>姓名</th>
                                                <th>战区</th>
                                                <th>战队</th>
                                                <th>报备数量</th>
                                                <th>带看数量</th>
                                                <th>成交数量</th>
                                                <th>带看转换率</th>
                                            </tr>
                                        </tfoot>
                                        <tbody></tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="tab-pane" id="exampleTabsTwo" role="tabpanel">
                                <div class="panel-body">
                                    <h4 class="example-title">数据查询</h4>
                                    <div class="row">
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">姓名</label>
                                            <input id="txt_XingMing" class="form-control" />
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">开始时间</label>
                                            <input type="text" class="form-control empty" autocomplete="off" data-date-format="yyyy-mm-dd" name="" id="txt_KaiShiShiJian_ZhiYe" data-plugin="datepicker" data-language="zh-CN" placeholder="请输入查询开始时间" />
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">结束时间</label>
                                            <input type="text" class="form-control empty" autocomplete="off" data-date-format="yyyy-mm-dd" name="" id="txt_JieShuShiJian_ZhiYe" data-plugin="datepicker" data-language="zh-CN" placeholder="请输入查询结束时间" />
                                        </div>
                                        <div class="form-group col-sm-4">
                                            <label class="col-form-label" for="for_XingBie">部门</label>
                                            <select id="dl_BuMen" class="form-control">
                                                <option value="0">请选择</option>
                                            </select>
                                        </div>

                                        <div class="form-group col-sm-4">
                                            <div class="form-group col-sm-12" style="padding-top:27px">
                                                <button type="button" id="bt_ChaXun" class="btn btn-block btn-success" style="width: 45%; float: left;" onclick="BangZhiYe()"><i class="icon wb-search"></i>查询</button>
                                                <button typeutton" id="bt_ChongZhi" class="btn btn-outline btn-success" style="width: 45%; margin-left:5%;" onclick="chongzhi1();">重置</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="panel-body" style="margin-top:-50px">
                                    <table class="table table-bordered table-hover dataTable table-striped w-full text-nowrap" id="dataTableExample1" data-plugin="dataTable">
                                        <thead>
                                            <tr>
                                                <th>姓名</th>
                                                <th>部门名称</th>
                                                <th>报备数量</th>
                                                <th>带看数量</th>
                                                <th>成交数量</th>
                                                <th>带看转换率</th>
                                            </tr>
                                        </thead>
                                        <tfoot>
                                            <tr>
                                                <th>姓名</th>
                                                <th>部门名称</th>
                                                <th>报备数量</th>
                                                <th>带看数量</th>
                                                <th>成交数量</th>
                                                <th>带看转换率</th>
                                            </tr>
                                        </tfoot>
                                        <tbody></tbody>
                                    </table>
                                </div>
                            </div>
                            @*<div class="tab-pane" id="exampleTabsThree" role="tabpanel">
                                    车轮查违章与百度地图推出《中国车主违章地图大数据》报告，江苏高居“违章停车”榜首，在全国范围内，江苏、湖北、山东、浙江以及北京五个省市中的车主违章比例最高，其中江苏省以高达11.52%的比例遥遥领先。另外，江苏、湖北、山东三省的“马路杀手”已经超过了全国人口最多的广东省。有62.38%是不按规定行驶，26.18%超速、7.13%违章停车、2.82%无视尾号限行、1.49%不系安全带和不带头盔。
                                </div>
                                <div class="tab-pane" id="exampleTabsFour" role="tabpanel">
                                    滴滴出行今日宣布，已在全国一百个城市正式上线了服务信用体系。未来每位快车车主都将拥有个人专属的服务信用档案和服务分值，为乘客提供优质服务的车主可获得更高的服务分，从而获得更多的订单和收入。因服务分每日变化，滴滴服务信用系统会根据每位快车车主的具体情况，帮助车主定制每天提高服务分的攻略。
                                </div>*@
                        </div>
                    </div>
                </div>


            </div>
        </div>
    </div>
</div>